package org.jiopi.ibean.kernel.remote;

import org.jiopi.framework.ControlPanel;
import org.jiopi.ibean.kernel.NameVersion;
import org.jiopi.ibean.kernel.util.ObjectAccessor;
import org.jiopi.remote.RemoteCentralConsole;

public class RemoteControlPanelImpl implements ControlPanel {
	
	private final RemoteCentralConsole _rcc;
	
	private final String _registerName;
	
	private final NameVersion _moduleVersion;
	
	
	
	public RemoteControlPanelImpl(RemoteCentralConsole rcc,NameVersion moduleVersion,String registerName){
		_rcc = rcc;
		_moduleVersion = moduleVersion;
		_registerName = registerName;
	}
	
	@Override
	public <T> T operate(String registerName, Class<T> returnType,Object... args) {
		Object result = _rcc.methodCall(null, _moduleVersion.name, _moduleVersion.version, _registerName, registerName, null, args);
		//System.out.println("Helloaaa");
		return ObjectAccessor.processReturnValue(result, returnType);
		//return null;
	}

	@Override
	public <T> T operateStrict(String registerName, Class<T> returnType,Object[] parameterTypes, Object... args) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public <T> T variable(String variableName, Class<T> returnType) {
		// TODO Auto-generated method stub
		return null;
	}

}
